﻿using PlatformUW.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PlatformUW.EntityFramework.Repositories.Extensions
{
    public static class PlayerRepositoryExtensions
    {
        public static IQueryable<Player> FilterByName(this IQueryable<Player> players, string? name)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                return players;
            }
            return players.Where(player => 
               player.Account.Contains(name.Trim().ToLower()));
        }
    }
}
